package com.aynu.webshop.web.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.aynu.webshop.core.generic.GenericDao;
import com.aynu.webshop.core.generic.GenericServiceImpl;
import com.aynu.webshop.web.dao.CartMapper;
import com.aynu.webshop.web.model.Cart;
import com.aynu.webshop.web.service.CartService;

@Service
public class CartServiceImpl extends GenericServiceImpl<Cart, Integer> implements CartService {

	@Resource
	private CartMapper cartMapper;
	
	@Override
	public int insert(Cart model) {
		// TODO Auto-generated method stub
		return cartMapper.insertSelective(model);
	}

	@Override
	public int update(Cart model) {
		// TODO Auto-generated method stub
		return cartMapper.updateByPrimaryKeySelective(model);
	}

	@Override
	public int delete(Integer id) {
		// TODO Auto-generated method stub
		return cartMapper.deleteByPrimaryKey(id);
	}

	@Override
	public Cart selectById(Integer id) {
		// TODO Auto-generated method stub
		return cartMapper.selectByPrimaryKey(id);
	}

	@Override
	public Cart selectOne() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Cart> selectList() {
		// TODO Auto-generated method stub
		return cartMapper.findAll();
	}

	@Override
	public GenericDao<Cart, Integer> getDao() {
		// TODO Auto-generated method stub
		return cartMapper;
	}

	@Override
	public List<Cart> selectByuId(Integer uid) {
		// TODO Auto-generated method stub
		return cartMapper.findByuId(uid);
	}

}
